//
//  POWindow.m
//  POBase
//
//  Created by Pieter Omvlee on 5/31/08.
//  Copyright 2008 Bohemian Coding. All rights reserved.
//

#import "CHWindow.h"


@implementation CHWindow

- (BOOL)isMovableByWindowBackground
{
  return YES;
}

- (void)flagsChanged:(NSEvent *)theEvent
{
  [[self delegate] flagsChanged:theEvent];
}

@end

@implementation CHOpaqueBox

- (BOOL)isOpaque
{
  return YES;
}

@end

@implementation CHOpaqueView

- (BOOL)isOpaque
{
  return NO;
}

- (BOOL)mouseDownCanMoveWindow
{
  return NO;
}

@end

@implementation NSWindow (NSWindowToolbar)

- (float)toolbarHeight
{
  NSToolbar *toolbar;
  float toolbarHeight = 0.0;
  NSRect windowFrame;
  
  toolbar = [self toolbar];
  
  if(toolbar && [toolbar isVisible]) {
    windowFrame = [NSWindow contentRectForFrameRect:[self frame]
                                          styleMask:[self styleMask]];
    toolbarHeight = NSHeight(windowFrame) - NSHeight([[self contentView] frame]);
  }
  
  return toolbarHeight;
}

@end

@implementation CHNonSeeThroughView : NSView

- (BOOL)isOpaque
{
  return YES;
}

@end